package com.atguigu.cloud.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:EmpowerController
 * Package:com.atguigu.cloud.controller
 * Description: 描述信息
 *
 * @date:2024/3/6 17:25
 * @author:坤坤
 */
@RestController
@Slf4j
public class EmpowerController //Empower授权规则，用来处理请求的来源
{
    @GetMapping(value = "/empower")
    @SentinelResource(value = "empower",blockHandler = "sentinelXL")
    public String requestSentinel4(){
        log.info("测试Sentinel授权规则empower");
        return "Sentinel授权规则";
    }

    public String sentinelXL(BlockException blockException){
        return "黑名单，sentinel限制";
    }

}